home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
rjs.lha
/
RJS
/
Transport
/
tests
/
sserver.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-14
|
663b
|
35 lines
#include <iostream.h>
#include <stdio.h>
#include <osfcn.h>
#include <libc.h>
#include "RJS/Transport.h"
int main(int argc, char *argv[])
{
if (argc!=2) {
cerr << "usage: " << argv[0] << " port" << endl;
exit(1);
}
InetAddress port(atoi(argv[1]));
InetDatagram dg;
InetAddress from;
char buffer[10];
dg.socket_server(port);
dg.getsockname(port);
cout << "server: port ==> " << port << endl;
dg.recvfrom(buffer,10,from);
cout << "server: read ==> '" << buffer << "'" << endl;
cout << "server: from ==> " << from << endl;
int nbw=dg.sendto("bye",4,from);
cout << "server: sent ==> " << nbw << " bytes" << endl;
exit(0);
}